home *** CD-ROM | disk | FTP | other *** search
- Hints & Tips
- 1.11
- • *COMPACT − The User Guide says that *COMPACT “moves files around on
- the disc, collecting all the free space into a continuous block”.
- However, if you have a disc that has several gaps you will find that you
- need several compactions. One disc which had 5 gaps in the FS map had to
- be compacted eight times before the map showed only a single gap. (See
- review of R.A.Engineering’s Utilities, page ?????)
- 1.11
- • *COPY − When copying multiple files using wildcards, you must ONLY
- specify the directory into which to copy and not try to specify the
- actual file name in any way e.g. if you want to copy files PROGA, PROGB,
- PROGC etc from the “BASIC” directory into the “BACKUP” directory, use
- *COPY $.BASIC.PROG* $.BACKUP.* but if you try to use *COPY $.BASIC.PROG*
- $.BACKUP.PROG* it won’t work. This is not desperately clear in the User
- Guide and I’ve only just worked out why 90% of my attempts to do
- wildcard copies have not worked!
- 1.11
- • CAPS LOCK − Another thing which is obvious if you know about it is
- that you can set up the keyboard to print upper case normally but then
- go into lower case when you press <shift>. This can be done either by
- *Configure SHCAPS if you want it to start up in that mode (or CAPS or
- NOCAPS if you don’t) or by holding the shift key down and pressing and
- releasing the Caps Lock key.
- 1.11
- • CHAINing programs − In response to our complaint in last month’s Bug
- or Feature that programs chaining one another cannot be called from
- drive 1 using the desktop, Philip Colmer of Acorn’s Customer Support
- Department tells us that it is definitely a feature. There are a number
- of ways of avoiding the problem. Firstly, you could reference files by
- disc name, so we could CHAIN“:ProgDisc.$.Progs.Nextprog” or whatever.
- Alternatively, you could use the fact that when you run a BASIC program
- in drive 1 from the desktop, it generates a command something like
- *basic −quit “ADFS::1.$.Progs.FirstProg”. You could then use OS_GetEnv
- to read the command string and find out where the program has been
- called from. Thridly, have a look at PC.PC from the 1.20 version of the
- PC emulator to see an intelligent (incredibly so!) boot-up program which
- has been very carefully commented to enable you to modify it for your
- own use.
- 1.11
- • Auto-booting − Again from Philip Colmer comes the suggestion that
- you should use the PC.PC program to boot up applications from within
- directories on the hard disc. The program uses legal OS calls instead of
- re-configuring. It does a *DIR and then runs the program specified. The
- only restriction on it is that it cannot change the system sprite size
- but, he points out, if programs were written properly, they would not be
- using the system sprite area!
- 1.11
- • System Devices − You can treat devices as files, e.g.
- C%=OPENOUT(“NETPRINT:”). This is particularly useful in the example
- given on page 9 last month because you can now open a channel to the
- network printer, send some stuff to it when you are ready (using BPUT
- #C%) and when everything is done, close the ‘file’ (CLOSE#0) and it will
- then be printed! (This also came from Philip Colmer − Thanks PC! −
- Funny, you know, I always thought that PC stood for Personal Computer!
- Ed.)
- 1.11
- The following Hints were prepared by Adrian LookÉ
- 1.11
- • Smooth Scrolling − Using VDU 23,7 you can scroll the current text
- window up, down, left, or right. Horizontally, the picture can be
- scrolled by one byte, but vertically it can only be scrolled by one
- character cell. This can produce a smooth scroll by placing a WAIT (for
- the vertical sync pulse) command before the VDU 23,7. If any further
- delay is implemented then the picture shudders as it scrolls. This means
- that a slow smooth scroll cannot be used. The answer is to redefine the
- screen base address manually (as we used to do on the BBC). This is done
- using ‘OS_Word’ &16.
- 1.11
- DIM block% 4
- 1.11
- :
- 1.11
- block%?0=type
- 1.11
- block%!1=offset
- 1.11
- WAIT
- 1.11
- SYS “OS_Word”,&16,block%
- 1.11
- “type” : when 1 − base used by VDU drivers (i.e. screen updated)
- 1.11
- : when 2 − base used by hardware (i.e. screen displayed)
- 1.11
- “offset” : from the address of the base of the screen buffer to the
- start of the screen display.
- 1.11
- The following example program should help to make it clearer.
- 1.11
- 10 REM >scrolling
- 1.11
- 20
- 1.11
- 30 REM **************************
- 1.11
- 40 REM * Scrolling Screens?? *
- 1.11
- 50 REM * written by Adrian Look *
- 1.11
- 60 REM * 21st July 1988 *
- 1.11
- 70 REM **************************
- 1.11
- 80
- 1.11
- 90 MODE 0:OFF
- 1.11
- 100 DIM block% &10
- 1.11
- 110 count=0
- 1.11
- 120
- 1.11
- 130 PRINTTAB(3,15);“Some text”
- 1.11
- 140
- 1.11
- 150 REPEAT
- 1.11
- 160 PROCscroll(1)
- 1.11
- 170 UNTIL 0
- 1.11
- 180 END
- 1.11
- 190
- 1.11
- 200 DEFPROCscroll(speed)
- 1.11
- 210 PROCinfo
- 1.11
- 220 add=x/m
- 1.11
- 230 IF SGN(count)>0 THEN speed=-speed
- 1.11
- 240 REPEAT
- 1.11
- 250 block%?0=2
- 1.11
- 260 block%!1=add*count
- 1.11
- 270 WAIT
- 1.11
- 280 SYS “OS_Word”,22,block%
- 1.11
- 290 count+=speed
- 1.11
- 300 UNTIL add*count>x*y/m+4160 OR count<0
- 1.11
- 310 ENDPROC
- 1.11
- 320
- 1.11
- 330 DEFPROCinfo
- 1.11
- 340 SYS “OS_ReadModeVariable”,MODE,4 TO ,,x
- 1.11
- 350 x=4-x:x=8*(2^x)*10
- 1.11
- 360 SYS “OS_ReadModeVariable”,MODE,5 TO ,,y
- 1.11
- 370 y=3-y:y=y*256
- 1.11
- 380 SYS “OS_ReadModeVariable”,MODE,3 TO ,,c
- 1.11
- 390 CASE c OF
- 1.11
- 400 WHEN 1 : m=8
- 1.11
- 410 WHEN 3 : m=4
- 1.11
- 420 WHEN 15 : m=2
- 1.11
- 430 WHEN 63 : m=1
- 1.11
- 440 ENDCASE
- 1.11
- 450 ENDPROC
- 1.11
-
- 1.11
- • Desktop Utilities − The desktop is essentially a skeleton program
- which allows the programmer to install his/her own icons, windows,
- menus, commands, etc, which the DeskTop will then operate. This is done
- with a very clever set of FN’s. for example:
- 1.11
- PROCinstall(“adrian”)
- 1.11
- :
- 1.11
- DEFPROCinstall(file$)
- 1.11
- INSTALL file$
- 1.11
- void=EVAL(“FNinstall_file_”+file$)
- 1.11
- ENDPROC
- 1.11
- This means that by EVALuating a string the DeskTop can call any file-
- specific function. In the case above, FNinstall_file_adrian will be
- called. By using this system, any command can be ‘installed’ or even
- replaced. Explaining or even listing the functions and procedures
- available in the DeskTop program is not really possible in the magazine.
- However, bearing in mind the methods used, you will find before long you
- can write some very useful tools for the DeskTop. It should even
- possible to completely re-write the it! As an example, here is a program
- which will allow you to use star commands. Don’t forget to *SETTYPE
- ‘filename’ FE0 to indicate that the program is a desktop utility (We
- have included several other utilities on the program disk).
- 1.11
- 10 REM >star
- 1.11
- 20
- 1.11
- 30 REM *******************************
- 1.11
- 40 REM * Star Commands for Desk Top *
- 1.11
- 50 REM * written by Adrian Look *
- 1.11
- 60 REM * original idea Denis Howlett *
- 1.11
- 70 REM *******************************
- 1.11
- 80
- 1.11
- 90 DEFFNinstall_file_star
- 1.11
- 100 file=OPENIN(filehandler_path$+“.istar”):CLOSE #file
- 1.11
- 110 IF file=0 THEN ERROR 1,“Can’t find icon file ‘istar’”
- 1.11
- 120 OSCLI(“SMERGE ”+filehandler_path$+“.istar”)
- 1.11
- 130
- PROCsys_addtoiconbar(“star”,“command”,&301A,icon_fgcol,icon_bgcol,48)
- 1.11
- 140 SYS “Wimp_ForceRedraw”,-1,0,0,1279,100
- 1.11
- 150 =0
- 1.11
- 160
- 1.11
- 170 DEFFNaction_star
- 1.11
- 180 PROCstar_command(5,5,75,25,2,1)
- 1.11
- 190 =0
- 1.11
- 200
- 1.11
- 210 DEFPROCstar_command(x0,y0,x1,y1,bx,by)
- 1.11
- 220 *POINTER 0
- 1.11
- 230 VDU 26,4,28,x0,y1,x1,y0
- 1.11
- 240 y0=31-y0:y1=31-y1
- 1.11
- 250 gx=x0*16-bx*8:dx=(x1-x0)*16+bx*16+16
- 1.11
- 260 gy=y1*32-by*16:dy=(y0-y1)*32+by*32+32
- 1.11
- 270 GCOL 0,&4:RECTANGLE FILL gx-4,gy-4,dx+8,dy+8
- 1.11
- 280 GCOL 0,&0:RECTANGLE FILL gx,gy,dx,dy
- 1.11
- 290 LOCAL ERROR
- 1.11
- 300 REPEAT
- 1.11
- 310 ON ERROR LOCAL PRINT REPORT$
- 1.11
- 320 *FX 4,0
- 1.11
- 330 INPUT“*”star$
- 1.11
- 340 *FX 4,1
- 1.11
- 350 OSCLI(star$)
- 1.11
- 360 UNTIL star$=“”
- 1.11
- 370 RESTORE ERROR
- 1.11
- 380 SYS “Wimp_ForceRedraw”,-1,gx-4,gy-4,gx+dx+8,gy+dy+8
- 1.11
- 390 VDU 26,5
- 1.11
- 400 *FX 21,9
- 1.11
- 410 *POINTER
- 1.11
- 420 ENDPROC
- 1.11
- N.B. (i) You will need a STAR shaped icon called ‘command’, saved as
- ‘istar’. However, if you want to test the program before designing an
- icon, skip lines 100-120 and change “command” in line 130 to “unknown”.
- 1.11
- (ii) Because the DeskTop uses the filename of the utility as a ‘seed’,
- it important that the utility’s filename be consistent with its
- procedure names. For example: if you rename ‘star’ to ‘command’ then the
- DeskTop will look for FNaction_command instead of FNaction_star, so you
- will get an error!
- 1.11
- • Making the Print Key Save − Last month it was suggested in Neil
- Strong’s article about making the print key print that a slight
- modification of the program could make it save screen shots to the disc
- using SCREENSAVE “$.pic” instead of HARDCOPYFX. However, this limits you
- to one screen shot at a time (otherwise you will overwrite your last
- one). If we use the system variables and update the ‘print key’ program
- we can get it to save a screen called ‘$.scr0’, followed by, ‘$.scr1’,
- ‘$.scr2’..etc!
- 1.11
- 871 adr r0,command1
- 1.11
- 872 swi “OS_CLI”
- 1.11
- 920 equs “ScreenSave scr<file>” ; FastSave even!#?
- 1.11
- 941 .command1
- 1.11
- 942 equs “SetEval file file+1”
- 1.11
- 943 EQUB 0
- 1.11
- 944 ALIGN
- 1.11
- 1020 OSCLI(“SetEval file 0”)
- 1.11
- 1030 END
- 1.11
- If you wish to (re)set the ‘file count’ to n, then just type:
- 1.11
- *SETEVAL file n
- 1.11
- • SpellMaster Browse in Wordwise Plus − If you have Spell-Master and
- Wordwise Plus you can very easily write a two line segment program which
- will call the browse window. i.e.
- 1.11
- *BROWSE
- 1.11
- DISPLAY
- 1.11
- Thus if the program were in segment zero you could press <shift><print>
- while editing your text and check your spelling using the browse window.
- This obviously opens up all sorts of possibilities for Wordwise Plus to
- use Spell Master’s facilities.
- 1.11
-